import ajax from '../utils/ajax.js'
import api from '../config/api.js'

import { globalData } from '../config/globalData'

/**
 * 获取福利列表
 */
function getWelfareList (state = 0, fun = function () {
}) {
  let url = baseUrl.server + api.GET_WELFARE_LIST
  let param = {
    token: globalData.access_token,
    status: state
  }

  ajax.post(url, param, function (res) {
    fun(res)
  })
}

/**
 * 获取最近一条福利通知
 */
function getWelfareInform (fun = function () {
}) {
  let url = baseUrl.server + api.GET_WELFARE_INFORM
  let param = {
    token: globalData.access_token
  }
  ajax.post(url, param, function (res) {
    fun(res)
  })
}

module.exports = {
  getWelfareList,
  getWelfareInform
}
